import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;


class SortBySKU implements Comparator<Product>
{
	public int compare(Product p1, Product p2) 
	{
		return p1.SKU.compareToIgnoreCase(p2.SKU);
	}
	
}
class SortByName implements Comparator<Product>
{
	public int compare(Product p1, Product p2) 
	{
		return p1.name.compareToIgnoreCase(p2.name);
	}
	
}

public class Jamil {
	public static void main(String[] args) 
	{
		Product p1 = new Product("123","Bag","red","nike","L","Jamil");
		Product p2 = new Product("234","Ball","blue","rebok","S","Vineet");
		Product p3 = new Product("345","Box","green","vip","M","Jack");
		Product p4 = new Product("456","Belt","yellow","addidas","XL","Jim");
		Product p5 = new Product("567","Bat","Black","addidas","M","John");
		
		List<Product> list = new ArrayList<Product>();
		list.add(p1);
		list.add(p3);
		list.add(p2);
		list.add(p5);
		list.add(p4);
		
		SortBySKU c = new SortBySKU();
		Collections.sort(list, c);
		
		Iterator<Product> sortedItr = list.iterator();
		while(sortedItr.hasNext())
		{
			String sku = sortedItr.next().SKU;
			System.out.println(sku);
		}
		
		SortByName n = new SortByName();
		Collections.sort(list, c);
		
		sortedItr = list.iterator();
		while(sortedItr.hasNext())
		{
			String name = sortedItr.next().name;
			System.out.println(name);
		}
		
		
	}	
}